import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
declare let L;

@Component({
  selector: 'app-map',
  templateUrl: './map.component.html',
  styleUrls: [
    './map.component.less',
    '../../assets/leaflet/leaflet.css'
  ]
})
export class MapComponent implements OnInit {
  mapId;

  constructor(private route: ActivatedRoute) {

  }

  ngOnInit() {
    this.route.paramMap.subscribe(params => {
      this.mapId = params.get('productId');
      console.log(this.mapId)
    });

    // todo  拓展地图功能

    // const map = L.map('map').setView([51.505, -0.09], 13);
    // L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
    //   attribution: '? <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
    // }).addTo(map);

    // L.Routing.control({  //这里是新添加的
    //   waypoints: [
    //     L.latLng(57.74, 11.94),
    //     L.latLng(57.6792, 11.949)
    //   ]
    // }).addTo(map);
  }

}
